﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ApprovalTests;
using ApprovalTests.Combinations;
using ApprovalTests.Reporters;

namespace LegacyCodeDemo
{
    
    [TestClass]
    public class UnitTest1
    {
        #region ShowSimpleArray
        
        [ApprovalTests.Reporters.UseReporter(typeof(DiffReporter))]
        [TestMethod]
        public void TestArray()
        {
            var word = "SoCalDevGal"; 
            ApprovalTests.Approvals.Approve(word, word.ToCharArray(), (c) => c + " => " + (int)c);
        }
        #endregion

        #region ShowCombinationsSmall
        
        [TestMethod]
        [ApprovalTests.Reporters
            .UseReporter(typeof(DiffReporter))]
        public void TestRangeSmall()
        {
            var p = new Person();
            ApprovalTests.Combinations.CombinationApprovals.VerifyAllCombinations(
                    (int c, int d) => p.Add(c, d),
                    Enumerable.Range(1, 10),
                    //change range to 3 to show granularity
                    Enumerable.Range(2, 10));
        }
        #endregion

        #region ShowCombinationsBig

        [ApprovalTests.Reporters.UseReporter(typeof(FileLauncherReporter))]
        [TestMethod]
        public void TestRangeBig()
        {
            var p = new Person();
            ApprovalTests.Combinations.CombinationApprovals.VerifyAllCombinations(
                (int c, int d) => p.Add(c, d),
                Enumerable.Range(-10, 1000),
                Enumerable.Range(2, 10));
        }
        #endregion

        #region ShowCombinationsHuge

        [ApprovalTests.Reporters.UseReporter(typeof(FileLauncherReporter))]
        [TestMethod]
        public void TestRangeHuge()
        {
            var p = new Person();
            ApprovalTests.Combinations.CombinationApprovals.VerifyAllCombinations(
                (int q, int r, int s) => p.BigAdd(q, r, s),
                Enumerable.Range(-10, 1000),
                Enumerable.Range(2, 10),
                Enumerable.Range(1,100));
        }
        #endregion
    }
}